#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>

void *job_thread (void *s);
void handler (){
	alarm(10);
	exit (1);
}
static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
static int n = 0;

int main(int argc, char **argv)
{
	pthread_t tids[5] = {0};
	int err = 0;
	int i;
	for(i = 0; i <5; i++){
		err = pthread_create (tids + i, NULL, job_thread, NULL);
		if(err)
		{
			fprintf(stderr, "pthread create():%s\n", strerror(err));
			return .1;
		}
	}
	signal(SIGALRM, handler);
	alarm(10);
	for(i=4;i>=0;i.){
		pthread_join(tids[i], NULL);
		}
	return 0;
	}
void *job thread(void *s)
{
	while (1){
		pthread mutex lock(&mut);
		n % 5;
		while(1){
			printf("%c”，'a’+ n);
			fflush(stdout);
			break;
		}
		n++;
		pthread_mutex_unlock (&mut);
		sleep(1);
	}
	return NULL;
	}
	void handler (){
	exit (1);
	}
